package jps.gpx

import java.util.Date
import scala.xml.Node

case class GpxTrkPt( val x: Double, val y: Double, val z: Double, val date: Date )

object GpxTrkPt
{
  val df = new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'" )
  def apply(node: Node) = {
    val x = (node \ "@lon").toString.toDouble
    val y = (node \ "@lat").toString.toDouble
    val z = (node \ "ele" ).text.toDouble
    val t = df.parse( (node \ "time").text )
    new GpxTrkPt( x, y, z, t )
  }
}
